package com.scuec.tourismwebsite.controller;

import com.github.pagehelper.PageInfo;
import com.scuec.tourismwebsite.entity.WeatherTourism;
import com.scuec.tourismwebsite.service.WeatherTourismService;
import com.scuec.tourismwebsite.vo.ViewWeatherTourism;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


@RestController
@RequestMapping("/weather-tourism")
@CrossOrigin
public class WeatherTourismController {
    @Autowired
    private WeatherTourismService weatherTourismService;

    @GetMapping("/page")
    public PageInfo<ViewWeatherTourism> getWeatherTourismPages(Integer pageNum, Integer pageSize) {
        PageInfo<ViewWeatherTourism> pageInfo=weatherTourismService.findWeatherTourismPages(pageNum,pageSize);
        return pageInfo;
    }

    @GetMapping("/query")
    public List<ViewWeatherTourism> findWeatherTourism() {
        return weatherTourismService.findViewWeatherTourism();
    }

    @PostMapping("/insert")
    public Integer insertWeatherTourism(@RequestBody WeatherTourism weatherTourism) {
        return weatherTourismService.insertWeatherTourism(weatherTourism);
    }


    @PutMapping("/update")
    public Integer updateWeatherTourism(@RequestBody WeatherTourism weatherTourism) {
        return weatherTourismService.updateWeatherTourism( weatherTourism);
    }


    @DeleteMapping("/del")
    public Integer deleteWeatherTourism(Integer idweather_tourism) {
        return weatherTourismService.deleteWeatherTourism(idweather_tourism);
    }

}
//1